package com.tebiecloud.mpweixin.server.service.impl;

import com.tebiecloud.common.utils.JsonUtils;
import com.tebiecloud.mpweixin.client.model.entity.MpweixinUser;
import com.tebiecloud.mpweixin.server.service.MpweixinApiService;
import com.tebiecloud.mpweixin.server.utils.MPApi;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * 公众号接口
 * @Author: tebie
 * @Date: 2019-09-10 13:16
 */
@Slf4j
@Service
public class MpweixinApiServiceImpl implements MpweixinApiService {

    @Override
    public MpweixinUser getMpweixinUser(String accessToken, String openid) {
        String resp = MPApi.getSnsUserinfo(accessToken, openid);
        return JsonUtils.str2Bean(resp, MpweixinUser.class);
    }

}
